﻿#ifndef PLAN_H
#define PLAN_H

#include "bizeditor.h"
#include "planadd.h"
#include "epi_bizadd.h"

#define ETC_BIZ "/epiboly_plan.ini"

namespace Ui {
class Plan;
}

class Plan : public BizEditor
{
    Q_OBJECT

public:
    explicit Plan(QWidget *parent = 0);
    ~Plan();

    void updateView();

    void generateMenu();
    void createMenu();

    bool loadColumnWidth();
    void saveColumnWidth();
    void setHeaderData();

    void search();
    void save();
    void revert();

    void newItem();
    void en_finish();
    void en_remove();
    void en_cancel();
    void edit_on();
    void edit_off();

    void cancelIndex();
    void cancelDetail();

    void updateDetail(const QString &uid);

private slots:
    void on_indexView_clicked(const QModelIndex &index);
    void on_detailView_doubleClicked(const QModelIndex &index);

    void on_indexView_pressed(const QModelIndex &);
    void on_detailView_pressed(const QModelIndex &);
    void on_indexView_doubleClicked(const QModelIndex &);

private:
    Ui::Plan *ui;

    QString detailTable;

    bool loadDetailColWidthFlag;
    QMap<int,int> detailColWidth;

    QSqlTableModel *detailModel;
};

#endif // PLAN_H
